#include <stdio.h>
#include <stdlib.h>

int main(int argc, char* argv[]) {
    FILE *f1 = fopen("mat1.txt", "w");
    FILE *f2 = fopen("mat2.txt", "w");

    size_t size[] = {atol(argv[1]), atol(argv[2]), atol(argv[3])};
    fprintf(f1, "%zu %zu\n", size[0], size[1]);
    fprintf(f2, "%zu %zu\n", size[1], size[2]);

    for (size_t i = 0; i < size[0] * size[1]; ++i) {
        fprintf(f1, "%lf\n", (double)rand() / RAND_MAX);
    }

    for (size_t i = 0; i < size[1] * size[2]; ++i) {
        fprintf(f2, "%lf\n", (double)rand() / RAND_MAX);
    }

    fclose(f1);
    fclose(f2);
}
